package com.cci.kangdao.dao;

import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.MapperScan;

import java.util.List;
import java.util.Map;

/**
 * @author William Du
 * @date 2019/4/30
 */
@MapperScan
public interface CompanyUserGroupRelationDao {

    @Select("select roles.* from Roles_T roles,UserGroupHasRole_T groupRoles,CompanyUserGroupRelation_T relation " +
            "where roles.Flag = 0 and groupRoles.Flag=0 and relation.Flag = 0 " +
            "and roles.isApply = 1 and roles.ID = groupRoles.RoleId and relation.UserGroupId = groupRoles.UserGroupId and (relation.UserGroupType = 1 or relation.UserGroupType = 3) and relation.CompanyId=#{companyId}")
    List<Map<String,Object>> getRoleListByCompanyId(Long companyId);

    @Select("select * from CompanyUserGroupRelation_T where CompanyId = #{companyId} and UserGroupType in (1,3)")
    Map<String,Object> getCompanyUserGroup(Long companyId);

}
